package com.tkk.monitoring.server;

import com.tkk.monitoring.filter.Filter;
import org.littleshoot.proxy.HttpProxyServer;
import org.littleshoot.proxy.impl.DefaultHttpProxyServer;

/**
 * author: Tkk
 * date: 2015/7/7
 */
public class ProxyServer {

    private static HttpProxyServer httpProxyServer;

    public synchronized static void start(int port) {
        httpProxyServer = DefaultHttpProxyServer
                .bootstrap()
                .withPort(port)
                .withAuthenticateSslClients(false)
                .withFiltersSource(new Filter())
                .start();
    }

    public static HttpProxyServer getServer() {
        return httpProxyServer;
    }
}
